<%--
  Created by IntelliJ IDEA.
  User: luo
  Date: 2020/7/20
  Time: 14:41
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <base href="${pageContext.request.scheme}://${pageContext.request.serverName}:${pageContext.request.serverPort}${pageContext.request.contextPath}/"/>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <script src="static/lib/jquery-3.4.1/jquery-3.4.1.min.js"></script>
    <link rel="stylesheet" href="static/lib/layui-v2.5.5/css/layui.css"  media="all">
    <title>adjustmentDetail</title>
</head>
<body>
<fieldset class="layui-elem-field" style="padding: 30px;">
    <legend>理算详细信息</legend>
    <table lay-filter="adjustmentDetail" class="layui-hide" id="adjustmentDetail"></table>
    <button type="button" class="layui-btn del_claims layui-col-md-offset8"><i class="layui-icon layui-icon-delete" style="font-size: 30px; color: red;"></i>删除该理算信息</button>
    <button type="reset" class="layui-btn a_back"><i class="layui-icon layui-icon-close" style="font-size: 24px; color:red;"></i>关闭页面</button>
</fieldset>

</body>
<script src="static/lib/layui-v2.5.5/layui.js" charset="utf-8"></script>

<script>
    var line = parent.line;
    layui.use('table', function() {
        var layer = layui.layer;
        var table = layui.table;

        table.render({
            elem: '#adjustmentDetail'
            ,url:'claims/getadjustmentDetail?adjustmentid='+line.adjustmentid
            ,width: 1300
            ,cols: [[
                {field:'adjustmentdetailid', minWidth:120, title: '理算详情编号',fixed: 'left'}
                ,{field:'adjustmentid', minWidth:80, title: '理算编号'}
                ,{field:'itemtype', minWidth:80, title: '项目类型'}
                ,{field:'lossname', minWidth:100, title: '损失项目名称'}
                ,{field:'risktype', minWidth:100, title: '三者险分类'}
                ,{field:'losstotal', minWidth:100, title: '损失物金额'}
                ,{field:'suecharges', minWidth:80, title: '施救费用'}
                ,{field:'indemnitylimit', minWidth:80, title: '赔偿限额'}
                ,{field:'insurancepercentage',minWidth:80, title: '投保比例'}
                ,{field:'absolutelyfranchise', minWidth:100, title: '绝对免赔率'}
                ,{field:'deductibleaverage', minWidth:100, title: '绝对免赔额'}
                ,{field:'actualpay', minWidth:80, title: '实际赔付'}
            ]]
            ,id:'adjustmentDetail'
        });
        $('.a_back').click(function () {
            var index = parent.layer.getFrameIndex(window.name);
            parent.layer.close(index);
        });

        $('.del_claims').on('click', function(){
            if (line=="") {
                layer.msg("请先选择一行信息！");
            }else{
                layer.open({
                    content: '确认要删除ID为'+line.adjustmentid+'的理算信息吗？'
                    ,btn: ['确定', '取消']
                    ,yes: function(index, layero){
                        $.ajax({
                            url:'/claims/delAdjustment',
                            type:'get',
                            data:{'adjustmentid':line.adjustmentid} ,
                            dataType:"json",
                            success:function(data){
                                if(data){
                                    layer.msg("删除成功！");
                                    setTimeout(function () {
                                        var index = parent.layer.getFrameIndex(window.name);
                                        //关闭当前frame
                                        parent.layer.close(index);
                                        //修改成功后刷新父界面
                                        window.parent.location.reload();
                                    }, 800);
                                }
                                else{
                                    layer.msg("删除失败！")
                                }
                            },
                            error:function(e){
                                layer.msg("删除失败！")
                            },

                        });
                        return false;
                    }
                    ,btn2: function(index, layero){
                        layer.close(index);
                    }
                });
            }
        });
    });

</script>
</html>
